package org.amicofragile.simpledsl;

import org.amicofragile.simpledsl.Optimizer1;

import groovy.util.GroovyTestCase;

class Optimizer5Test extends GroovyTestCase {
	public void testFoo() {
		def processedList = Optimizer5.process {
			list([1, 3, 6, 4, 10, 2, 5, 3])
			criteria {it % 2 == 0 ? 'even' : 'odd'}
			rules {
				odd  {  it.inject(1) { acc, val -> acc * val }  }
				even {  it.sort()  }
			}
		}

		assertArrayEquals([3, 2, 4, 6, 10, 15].toArray(), processedList.toArray())
	}
}